from rest_framework.request import Request
from rest_framework.response import Response as originalResponse
from django.shortcuts import get_object_or_404
import functools
def func(params):
    def decorator(func):
        @functools.wraps(func)
        def wapper(*args,**kwargs):
            m_request= None
            for item in args:
                if isinstance(item, Request):
                    m_request= item
                    break
            if m_request:
                if ${KEY} in m_request.META:
                    # to check tenant access permission of app.
                    pass
                else:
                    return originalResponse({"state":-1, "msg": "not have 'tenant' params."})
            else:
                return originalResponse({"state":-1, "msg": "not have 'tenant' params."})
        return wapper
    return decorator   